<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<%
	String path = request.getContextPath();
%>
<title>血压监测-统计分析</title>
<link rel="stylesheet" type="text/css"
	href="<%=path%>/css/btn_class.css" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/ext-2.2/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="<%=path%>/ext-2.2/style.css" />
<script type="text/javascript"
	src="<%=path%>/ext-2.2/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="<%=path%>/ext-2.2/ext-all.js"></script>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript" src = "<%=path%>/FusionCharts/FusionCharts.js"></script>
	<script type="text/javascript" src = "<%=path%>/FusionCharts/FusionChartsExportComponent.js"></script>
	<script type="text/javascript" src="<%=path%>/js/datepicker/WdatePicker.js" defer="defer"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
	
</body>
<script type="text/javascript">
	Ext.BLANK_IMAGE_URL = "<%=path%>/ext-2.2/resources/images/default/s.gif";
	Ext.QuickTips.init();// 为组件提供提示信息功能，form的主要提示信息就是客户端验证的错误信息。
    Ext.form.Field.prototype.msgTarget='side'; 

	//同期对比 
	function show_chart_TBFX() {
		
		var foffi_type = Ext.get("foffi_type_value").dom.value;
		var fkslb_id = Ext.get("fkslb_id").dom.value;
		if(foffi_type == null || foffi_type == "") {
			//Ext.Msg.alert('提示', '请选择科室类别！'); 
			//return false;
		}
		if(fkslb_id == null || fkslb_id == "") {
			//Ext.Msg.alert('提示', '请选择科室类别！'); 
			//return false;
		}
		
		var fquery_str = "";
		var ftitle = "";
		var fbdate = Ext.get("fbdate_id").dom.value;
		var fedate = Ext.get("fedate_id").dom.value;
		
		fquery_str = "fbdate::" + fbdate + "##"
				   + "fedate::" + fedate + "##"
		           + "foffi_type::" + foffi_type + "##";
		ftitle = fbdate + " 至 " + fedate + " " + Ext.get("fkslb_id").dom.value;
		
		
		
		 //住院患者死亡人次统计
		Ext.Ajax.request({     
			 url : 'chartInfo!produceChartDataCommon.do',     
			 method : 'POST',     
			 params : {        
				 'fbh' : 'MCD2101',        
				 'fquery_str' : fquery_str,        
				 'ftitle' : ftitle,          
				 'foffi_type' : foffi_type     
				 },     
			 success : function(response, action) {        
				 var myChart;        
				 var data_str = new Array();        
				 var responseText = response.responseText; 
				 
				 data_str = responseText.split('$$');        
				 var chart_data = data_str[0];           
				 myChart = new FusionCharts("${basePath}/FusionCharts/MSColumn2D.swf","chartid2101","500","350","0","1");        
				 myChart.setDataXML(chart_data); 
				 myChart.render('chart2101');     

				 document.getElementById("text2101").innerHTML = "　　" + data_str[1];
			 },     
			 failure : function() {        
				 Ext.Msg.alert('错误', '服务器出现错误请稍后再试！');     
			 }  
		  });
		 
		//住院患者死亡人次统计
		Ext.Ajax.request({     
			 url : 'chartInfo!produceChartDataCommon.do',     
			 method : 'POST',     
			 params : {        
				 'fbh' : 'MCD2102',        
				 'fquery_str' : fquery_str,        
				 'ftitle' : ftitle,          
				 'foffi_type' : foffi_type     
				 },     
			 success : function(response, action) {        
				 var myChart;        
				 var data_str = new Array();        
				 var responseText = response.responseText; 
				 
				 data_str = responseText.split('$$');        
				 var chart_data = data_str[0];           
				 myChart = new FusionCharts("${basePath}/FusionCharts/Pie2D.swf","chartid2102","500","350","0","1");        
				 myChart.setDataXML(chart_data); 
				 myChart.render('chart2102');    
				 document.getElementById("text2102").innerHTML = "　　" + data_str[1];
			 },     
			 failure : function() {        
				 Ext.Msg.alert('错误', '服务器出现错误请稍后再试！');     
			 }  
		  });
		
		//住院患者按月统计
		Ext.Ajax.request({     
			 url : 'chartInfo!produceChartDataCommon.do',     
			 method : 'POST',     
			 params : {        
				 'fbh' : 'MCD2104',        
				 'fquery_str' : fquery_str,        
				 'ftitle' : ftitle,          
				 'foffi_type' : foffi_type     
				 },     
			 success : function(response, action) {        
				 var myChart;        
				 var data_str = new Array();        
				 var responseText = response.responseText; 
				 
				 data_str = responseText.split('$$');        
				 var chart_data = data_str[0];           
				 myChart = new FusionCharts("${basePath}/FusionCharts/Column2D.swf","chartid2103","800","300","0","1");        
				 myChart.setDataXML(chart_data); 
				 myChart.render('chart2103');     

				// document.getElementById("text2103").innerHTML = "　　" + data_str[1];
			 },     
			 failure : function() {        
				 Ext.Msg.alert('错误', '服务器出现错误请稍后再试！');     
			 }  
		  });
		
	}	
	

	

	Ext.onReady(function() {
		var Jthtwb_office = Ext.data.Record.create([ {
			name : 'fid',
			mapping : 'fid',
			type : 'string'
		}, {
			name : 'fname',
			mapping : 'fname',
			type : 'string'
		}]);
		
		var b_date = new Ext.form.TextField({
				fieldLabel : '开始日期',
				format: 'yyyy-MM-dd',
				id:'fbdate_id',
				name:'fbdate',
				width : 100,
				style:"cursor:pointer;color:blue",
				listeners : {
					'focus' : function() {
						WdatePicker({startDate:'%y-%M-%d',dateFmt:'yyyy-MM-dd',alwaysUseStartDate:true});
					}
				}
			});
           var e_date = new Ext.form.TextField({
   				fieldLabel : '结束日期',
   				format: 'yyyy-MM-dd',
   				id:'fedate_id',
				name:'fedate',
				width : 100,
				value : new Date().format('Y-m-d'),
   				style:"cursor:pointer;color:blue",
   				listeners : {
   					'focus' : function() {
   						WdatePicker({startDate:'%y-%M-%d',dateFmt:'yyyy-MM-dd',alwaysUseStartDate:true});
   					}
   				}
   			});
		
		//科室类型参数
		var foffi_type_store = new Ext.data.Store({
			reader : new Ext.data.JsonReader({
				totalProperty : 'totalProperty',
				root : 'root'
			}, Jthtwb_office),
			idProperty : 'threadid',
			remoteSort : true,
			url : 'officeInfo!queryOfficeType.do'
		});

		foffi_type_store.load({
			params : {
				start : 0,
				limit : 50
			}
		});
		
		
		var btn_search_tbfx = new Ext.Button({
			text : '图表分析',
			iconCls : 'sy-chart_bar',
			handler : function(btn) {
				document.getElementById("chart2101").innerHTML = "";
				document.getElementById("text2101").innerHTML = "";
				document.getElementById("chart2102").innerHTML = "";
				document.getElementById("text2102").innerHTML = "";
				document.getElementById("chart2103").innerHTML = "";
				show_chart_TBFX();
			}
		});
		
		
		//辅助工具按钮条
		var oneTbar = new Ext.Toolbar({
			items:[ '->', '-']
	    });
		
		//统计分析panel
	  	var tjfx_panel = new Ext.Panel({
	    	region: "center",
			layout:'fit',
			border : false,
		    //title:'&nbsp;&nbsp;&nbsp;图表示例',
		    //collapsible : true,
		    autoScroll : true,
			margins:'0 5 0 0',
			tbar : ['开始日期:', b_date, '-', '结束日期:', e_date, '-', btn_search_tbfx, {
					xtype : 'hidden',
					fieldLabel : '科室类别隐藏值',
					id : 'foffi_type_value'
				} ],
				listeners : {
					'render' : function(){
					//	oneTbar.render(this.tbar); //导出按钮条
					}
			 	},
			 	html : '<div bgcolor="#cfdefr" width="100%" height="100%"><table align="crnter">'
			 		+ '<tr> <td colspan="6" height="25"></td> </tr>'
 					+'<tr valign="top"><td align="center" id="chart2101"></td><td width="20"></td><td align="center" id="chart2102"></td></tr>'
 					+'<tr valign="top"><td align="left" id="text2101" style="font-size:12px"></td><td align="center" id="text2102" width="20"></td></tr>'
 					+ '<tr> <td colspan="6" align="left" height="15" id="chart2103"></td> </tr>'
 					
					+ '</table></div>'
		});
		
		
	  	
	  	//初始化面板
	  	var viewport = new Ext.Viewport({
            layout:'border',
            items:[tjfx_panel]
	  	});
	  	//调用生成图表方法,要在viewport之后才行,不然获取不到id,不显示内容
	  	//show_chart();
	  	
	});	
					
</script>


</html>